<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<title>新增</title>
<@fm.header />
</head>
<body>
<div class="easyui-layout" style="text-align: center; height: 270px;" fit="true">
	<div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
	<form id="ff" method="post" action="/miguVideoConfig/add" enctype="multipart/form-data">
	    <table>
		       <tr>
                   <td align="left">名称</td>
                   <td colspan="3">
                       <input type="text" name="name"  id="nameId" value="" style="width:300px;" class="easyui-validatebox" data-options="required:true">
                   </td>
               </tr>
               <tr>
                   <td align="left">日限</td>
                   <td colspan="3">
                       <input type="text" name="totalNum" id="totalNumId" value="" style="width:300px;" class="easyui-validatebox" data-options="required:true">
                   </td>
               </tr>
               <tr>
                   <td align="left">账号占比</td>
                   <td colspan="3">
                       <input type="text" name="userRate" id="userRateId" value="" style="width:300px;" class="easyui-validatebox" data-options="required:true">
                   </td>
               </tr>
               <tr>
		            <td><label for="apkUpload">包:</label></td>
		            <td colspan=3><input type="file" name="file" id="apk"></input></td>
	        	</tr>
		    </table>
		    <input type="hidden" name="status" id="status" value="0" style="width:300px;">
		    <input type="hidden" name="deleteFlag" id="deleteFlag" value="0" style="width:300px;">
		    <div style="padding: 25px; text-align: center;">
	            <a href="#" class="easyui-linkbutton" onclick="cancel();">取消</a>
	            <a href="#" class="easyui-linkbutton"  onclick="submit();">保存</a> 
        	</div>
</div>
<script>
$(function(){
	$("input").bind("keyup afterpaste", function(){
		$(this).val($(this).val().replace(/\s/g,''));
	});
});

function submit() {
	$("#ff").form('submit', {
		url : '/miguVideoConfig/add',
		onSubmit : function() {
			var flag = $(this).form('validate');
			if (flag) {
				showProcess(true, market.content.title, market.content.submitting);
			}
			return flag;
		},
		success : function(data) {
			showProcess(false);
			var data = eval('(' + data + ')');
			if (data.return_code == '1') {
				top.showMsg(market.content.title, data.return_msg, alert);
				if (parent !== undefined) {
					if ($.isFunction(parent.reloadParent)) {
						parent.reloadParent.call();
						parent.closeMyWindow();
					} else {
						parent.$("#tt").datagrid('reload');
						parent.closeMyWindow();
					}
				}
			} else {
				$.messager.alert(market.content.title, data.return_msg);
			}
		},
		onLoadError : function() {
			showProcess(false);
			$.messager.alert(market.content.title, market.content.networkError);
		}
	});
}

function cancel() {
	parent.closeMyWindow();
}
</script>
</body>
</html>